<template>
  <div>
    <main-box one="权限管理" two="权限列表">
      <!-- 表格 -->
      <el-table :data="rightList" style="width: 100%" border stripe>
        <el-table-column type="index"></el-table-column>
        <el-table-column prop="authName" label="权限名称" ></el-table-column>
        <el-table-column prop="path" label="路径" ></el-table-column>
        <el-table-column prop="level" label="权限等级" >
         <template slot-scope="scope">
            <el-tag v-if="scope.row.level=='0'">一级</el-tag>
          <el-tag v-else-if="scope.row.level=='1'" type="success">二级</el-tag>
          <el-tag v-else type="warning">三级</el-tag>
         </template>
        </el-table-column>
      </el-table>
    </main-box>
  </div>
</template>

<script>
// import MainBox from "../../pubcom/MainBox.vue";
export default {
  // components: {
  //   MainBox
  // },
  data() {
    return {
      rightList:[],
    }
  },
  mounted(){
    this.getRightList();
  },
  methods:{
    async getRightList() {
      const {data:res}=await this.$http.get('rights/list')
      console.log(res)
      if(res.meta.status!=200) {
        this.$message.error('获取权限列表数据失败');
      }
      this.rightList=res.data;
    }
    
  },
  
};
</script>

<style lang="less" scope>
</style>